<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>

<html>
<head>
<title>计价系统</title>
<!-- 新 Bootstrap 核心 CSS 文件 -->
<link rel="stylesheet" href="${ pageContext.request.contextPath }/css/bootstrap.min.css">

<!-- 可选的Bootstrap主题文件（一般不用引入） -->
<link rel="stylesheet" href="${ pageContext.request.contextPath }/css/bootstrap-theme.min.css">

<style type="text/css">
	body{
	padding-top:70px;
	}
</style>


<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
<script src="${ pageContext.request.contextPath }/js/jquery.min.js"></script>

<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="${ pageContext.request.contextPath }/js/bootstrap.min.js"></script>

</head>
<body>
	<nav class="navbar navbar-inverse navbar-fixed-top">
      <div class="container">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="#">螃蟹计价系统</a>
        </div>
        
        <!-- Collect the nav links, forms, and other content for toggling -->
	    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
	      
	      <ul class="nav navbar-nav">
	        <li><a href="${ pageContext.request.contextPath }/index.jsp">首页 <span class="caret"></span></a></li>
	        
	        <li class="dropdown">
	          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">清单创建 <span class="caret"></span></a>
	          <ul class="dropdown-menu">
	            <li><a href="${ pageContext.request.contextPath }/crab_list.do?isOrder=1">收货清单</a></li>
	            <li><a href="${ pageContext.request.contextPath }/crab_list.do?isOrder=0">出货清单</a></li>
	          </ul>
	        </li>
	        
	        <li class="dropdown">
	          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">今日汇总 <span class="caret"></span></a>
	          <ul class="dropdown-menu">
	            <li><a href="${ pageContext.request.contextPath }/order_searchByDate.do?isOrder=1">收货清单</a></li>
	            <li><a href="${ pageContext.request.contextPath }/order_searchByDate.do?isOrder=0">出货清单</a></li>
	            <li role="separator" class="divider"></li>
	            <li><a href="${ pageContext.request.contextPath }/order_searchNumberByDate.do">规格比较</a></li>
	          </ul>
	        </li>
	        
	        <li class="dropdown">
	          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">清单查询 <span class="caret"></span></a>
	          <ul class="dropdown-menu">
	            <li><a href="${ pageContext.request.contextPath }/order_search.do?isOrder=1">收货清单</a></li>
	            <li><a href="${ pageContext.request.contextPath }/order_search.do?isOrder=0">出货清单</a></li>
	            <li><a href="${ pageContext.request.contextPath }/order_searchNumberByTimeUI.do">规格查询</a></li>
	          </ul>
	        </li>
	        
	      </ul>
	     
	      <ul class="nav navbar-nav navbar-right">	
	        <li class="dropdown">
	          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">用户 <span class="caret"></span></a>
	          <ul class="dropdown-menu">
	            <li><a href="${ pageContext.request.contextPath }/user_updateUI.do?userid=1">修改用户</a></li>
	          </ul>
	        </li>
	      </ul>
	    </div><!-- /.navbar-collapse -->
       
      </div>
   </nav>
    
	<div class="container">
		<div class="row-fluid">
			<div class="span12">
				<h3 class="text-center">
					收货清单修改
				</h3>
				<br>
				<br>
				
				<s:form action="order_updateShow" method="post">
					<input type="hidden" name="id" value="<s:property value='#order.id' />"/>
					<input type="hidden" name="radio" value="<s:property value='#radio' />"/>
					<input type="hidden" name="time" value="<s:property value='#time' />"/>
					<input type="hidden" name="isOrder" value="<s:property value='#isOrder' />"/>
				<div class="row clearfix">
					<div class="col-md-2 column">
						<div class="form-group">
			    			<label for="username" class="control-label">客户</label>
			      			<input type="text" class="form-control" id="name" name="name" value="<s:property value='#order.clientName' />">
			    		</div>
		    		</div>
		    		
		    		<div class="col-md-7 column">
		    		</div>
		    		
		    		<div class="col-md-3 column">
		    			订单号：<s:property value="#order.id"/><br/>
						日期：<s:property value="#order.date"/>
		    		</div>
	    		</div>
	    		
	    		<s:if test="#order!=null">
	    		<div class="row clearfix">
	    			<div class="col-md-2 column"></div>
		    		<div class="col-md-8 column">
						<table class="table table-bordered">
							<caption class="text-center">
									公蟹
							</caption>
							<thead>
								<tr>
									<th>
										规格
									</th>
									<th>
										数量
									</th>
									<th>
										单价
									</th>
									<th>
										备注
									</th>
								</tr>
							</thead>
							<tbody>
							<s:iterator value="#order.crabList">
								<s:if test="ismale == 1">
									<input type="hidden" name="malecrabids" value="${id}"/>
								<tr>
									<td>
										${name}
									</td>
									<td>
							      		<input type="text"  class ="mount" name ="malemounts" value="${number }">
									</td>
									<td>
										<input type="text" name="malecrabPrice" class="price" value="${crabPrice.price }"/>
									</td>
									<td>
										<input type="text"  name ="maledescribes" value="${note }">
									</td>
								</tr>
								</s:if>
								</s:iterator>
							</tbody>
						</table>
					 </div>
					<div class="col-md-2 column"></div>
				   </div>
					
					<div class="row clearfix">
	    			 <div class="col-md-2 column"></div>
					 <div class="col-md-8 column">
						<table class="table table-bordered">
							<caption class="text-center">
									母蟹
							</caption>
							<thead>
								<tr>
									<th>
										规格
									</th>
									<th>
										数量
									</th>
									<th>
										单价
									</th>
									<th>
										备注
									</th>
								</tr>
							</thead>
							<tbody>
							<s:iterator value="#order.crabList">
								<s:if test="ismale == 0">
									<input type="hidden" name="femalecrabids" value="${id}"/>
								<tr>
									<td>
										${name}
									</td>
									<td>
							      		<input type="text"  class ="mount" name ="femalemounts" value="${number }">
									</td>
									<td>
										<input type="text" class="price" name="femalecrabPrice" value="${crabPrice.price }"/>
									</td>
									<td>
										<input type="text"  name ="femaledescribes" value="${note }">
									</td>
								</tr>
								</s:if>
								</s:iterator>
							</tbody>
						</table>
					 </div>
					  <div class="col-md-2 column"></div>
				 </div>
				
				 
				 <div class="row clearfix">
				 	<div class="col-md-4 column"></div>
				 	
				 	<div class="col-md-4 column">
				 		<input class="btn  btn-primary" type="submit" id="computebtn" value="确认修改"/>
				 		<s:if test="#radio==1">
							<a class="btn btn-primary" href="order_searchByTime.do?time=<s:property value='#time' />&isOrder=<s:property value='#isOrder'/>" role="button">退出</a>
						</s:if>
						<s:elseif test="#radio==2">
							<a class="btn btn-primary" href="order_searchByName.do?name=<s:property value='#order.clientName' />&isOrder=<s:property value='#isOrder'/>" role="button">退出</a>
						</s:elseif>
						<s:else>
							<a class="btn btn-primary" href="order_searchByDate.do?isOrder=<s:property value='#isOrder'/>"  role="button">退出</a>
						</s:else>
						
					 </div>
					 
					<div class="col-md-4 column"></div>
				</div>
				 </s:if>
				</s:form>
				
			</div>
		</div>
	</div>
	
</body>
</html>

<script type="text/javascript">

	$(function () {
		$("#name").blur(function(e){
			var username = $("#name").val();
			if(username == ""){
				alert("客户姓名不能为空！");
				$("#username").focus();
			}
		});
		
		$(".price").blur(function(){
			var price = $(this).val().trim();
			if(price != null && price !=""){
				if(isNaN(price)){
					alert("请输入数字");
					$(".price").focus();
				}
			}
		});
    
		$(".mount").blur(function(){
			var mount = $(this).val().trim();
			if(mount != null && mount !=""){
				if(isNaN(mount)){
					alert("请输入数字");
					$(".mount").focus();
				}
			}
		});
		
		$("#computebtn").click(function(){
			var username = $("#name").val().trim();
			if(username == ""){
				alert("客户姓名不能为空！");
				$("#username").focus();
				return false;
			}else{
				return true;
			}
		});
		
	});
 </script>